DEMO: An conditional is a piece of code that tells your program to do a group of commands if something is true.

There are two parts of an conditional:

The Test: if·answer·==·"yes":¬ This line tells your program "Test if this is equal to that".

The Commands: These lines of code come after the test and have a ····. They run if (and only if) the test is true.

  • Click Run to see the if statement. Then click Ticket and type your answer below each question.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)